package com.example.demo.service.impl;

import com.example.demo.entity.LendRecord;
import com.example.demo.mapper.LendRecordMapper;
import com.example.demo.service.LendRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class LendRecordServiceImpl implements LendRecordService {

    @Resource
    private LendRecordMapper lendRecordMapper;

    @Override
    public int insert(LendRecord lendRecord) {
        return lendRecordMapper.insert(lendRecord);
    }

    @Override
    public int updateByIsbn(String isbn, LendRecord lendRecord) {
        return lendRecordMapper.updateByIsbn(isbn, lendRecord);
    }

    @Override
    public int updateByCondition(LendRecord lendRecord) {
        return lendRecordMapper.updateByCondition(lendRecord);
    }

    @Override
    public int deleteByIsbn(String isbn) {
        return lendRecordMapper.deleteByIsbn(isbn);
    }

    @Override
    public int deleteByCondition(LendRecord lendRecord) {
        return lendRecordMapper.deleteByCondition(lendRecord);
    }

    @Override
    public List<LendRecord> selectPage(int pageNum, int pageSize, String search1, String search2, String search3) {
        int offset = (pageNum - 1) * pageSize;
        return lendRecordMapper.selectPage(offset, pageSize, search1, search2, search3);
    }

    @Override
    public int selectCount(String search1, String search2, String search3) {
        return lendRecordMapper.selectCount(search1, search2, search3);
    }

    @Override
    public Long selectTotalCount() {
        return lendRecordMapper.selectTotalCount();
    }
}